package cheers.cli;

import cheers.app.Main;
import cheers.model.Bar;
import cheers.service.BarService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main( String[] args ) {
        System.out.println("Starting application...");
        String appContextFile = "applicationContext.xml";
        ApplicationContext appContext = new ClassPathXmlApplicationContext( appContextFile );
        
        BarService barService = (BarService)appContext.getBean("barService");
        System.out.println("Retrieving list of bars...");
        for (Bar bar : barService.getAllBars()) {
            System.out.println(bar.getName());
        }
        System.out.println("Application end.");
        System.exit(0);
    }
}
